﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TextInfoAttachAdd.aspx.cs"
    Inherits="Backend_TextInfoAttach" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="!css/content.css" rel="stylesheet" type="text/css" />
    <script src="!js/jquery-1.7.1.js" type="text/javascript"></script>
    <script src="!js/uploadify-v3.1/jquery.uploadify-3.1.min.js" type="text/javascript"></script>
    <link href="!js/uploadify-v3.1/uploadify.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function () {
            var fileupload = $('#file_upload');
            fileupload.uploadify({
                swf: '!js/uploadify-v3.1/uploadify.swf',
                uploader: 'ashx/fileupload.ashx',
                queueID: 'fileQueue',
                //文件类型限制
                fileTypeDesc: "请选择jpg，png文件",
                fileTypeExts: "*.jpg;*.png",
                //自动上传
                auto: true,
                // Put your options here
                width: 120,
                height: 25,
                //是否允许多选
                multi: false,

                //每次可选择文件个数限制
                queueSizeLimit: 1,
                //可上传文件个数限制
                uploadLimit: 1,

                //向处理页传递SessionID参数，解决火狐Session失效的问题
                //参数名留意Globle.aspx
                formData: { "ASPSESSID": "<%=Session.SessionID %>" },
                onUploadSuccess: function (file, data, response) {
                    $('[id$=hfAttachPath]').val(data);
                    $('[id$=btnAdd]').show();
                },
                onUploadError: function (file, errorCode, errorMes, errorString) {
                    alert("error:" + errorString);
                }
            });

            //上传
            $('#upload').click(function () {
                fileupload.uploadify('upload');
                return false;
            });
            //取消
            $('#cancel_upload').click(function () {
                fileupload.uploadify('cancel');
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="content_top">
        <p>
            <label>
                1.每次上传一张图片,分多次上传。
            </label>
            <br />
            <label>
                2.图片格式为jpg或png。
            </label>
            <br />
            <label>
                3.图片描述不超过100字。
            </label>
        </p>
        <p>
            <label>
                图片描述:</label>
            <asp:TextBox runat="server" ID="txtAttachDesc" TextMode="MultiLine" Rows="5" Columns="50" />
        </p>
        <p>
            <asp:HiddenField ID="hfAttachPath" runat="server" />
            <input type="file" name="file_upload" id="file_upload" value=" " />
            <a id="cancel_upload" href="#">
                <label>
                    取消上传</label></a>
        </p>
        <p>
            <asp:Button Text="确定" ID="btnAdd" OnClick="btnAdd_Click" runat="server" Style="display: none" />
        </p>
        <p>
            <p id="fileQueue">
            </p>
        </p>
    </div>
    </form>
</body>
</html>
